package com.woniu.cms.contract.core.controller;


import com.woniu.cms.contract.core.entity.UndertakeContract;
import com.woniu.cms.contract.core.service.IUndertakeContractService;
import com.woniu.common.api.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author maple leaf
 * @since 2022-09-17
 */
@Api(tags = "承接合同管理")
@RestController
@RequestMapping("/undertake-contract-management")
public class UndertakeContractManagementController {

    @Autowired
    private IUndertakeContractService undertakeContractService;

    @ApiOperation("创建")
    @PostMapping
    public Result addUnder(@RequestBody UndertakeContract undertakeContract){
        Result result = undertakeContractService.addUnder(undertakeContract);
        return result;
    }

    @ApiOperation("审批")
    @PutMapping("/audit")
    public Result auditUnder(@RequestBody UndertakeContract undertakeContract){
        Result result = undertakeContractService.auditUnder(undertakeContract);
        return result;
    }

    @ApiOperation("删除")
    @DeleteMapping("{undertakeContractCode}")
    public Result delUnder(@PathVariable String undertakeContractCode){
        Result result = undertakeContractService.delUnder(undertakeContractCode);
        return result;
    }

    @ApiOperation("查询")
    @GetMapping
    public Result queryUnder(String undertakeContractCode,Integer currentPage, Integer pageSize){
        Result result = undertakeContractService.queryUnder(undertakeContractCode,currentPage,pageSize);
        return result;
    }

    @ApiOperation("修改")
    @PutMapping
    public Result updUnder(@RequestBody UndertakeContract undertakeContract){
        Result result = undertakeContractService.updUnder(undertakeContract);
        return result;
    }



}

